package com.ch.forum.service.impl;

import com.ch.forum.bo.ResponseResult;
import com.ch.forum.dao.MyBitCoinMapper;
import com.ch.forum.model.MyBitCoinModel;
import com.ch.forum.service.MyBitCoinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MyBitCoinServiceImpl implements MyBitCoinService {

    @Autowired
    private MyBitCoinMapper bitCoinMapper;

    @Override
    public ResponseResult findAll() {
        return new ResponseResult(true, "数据", bitCoinMapper.findAll());
    }

    @Override
    public ResponseResult add(MyBitCoinModel model) {
        if(model == null){
            return new ResponseResult(false, "参数不能为空");
        }
        return new ResponseResult(true, "操作成功", bitCoinMapper.add(model));
    }

    @Override
    public ResponseResult update(MyBitCoinModel model) {
        if(model == null){
            return new ResponseResult(false, "参数不能为空");
        }
        return new ResponseResult(true, "操作成功", bitCoinMapper.update(model));
    }

    @Override
    public ResponseResult findOne(Long id) {
        if(id == null){
            return new ResponseResult(false, "参数不能为空");
        }
        return new ResponseResult(true, "数据", bitCoinMapper.findOne(id));
    }
}
